import type { RouteRecordRaw } from "vue-router";
/**
 * 登录页面静态路由
 */
export const loginRoute: RouteRecordRaw = {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue')
}

/**
 * 主页面静态路由
 */
export const mainContainerRoute: RouteRecordRaw = {
    path: '/',
    name: 'layout',
    component: () => import('@/layout/index.vue'),
    redirect: "/home",
    children: []
}

/**
 * 所有静态路由
 */
export const constantRoutes: RouteRecordRaw[] = [
    loginRoute,
    mainContainerRoute,
    {
        path: '/:pathMatch(.*)*',
        name: '404',
        component: () => import('@/views/404.vue')
    }
]

/**
 * 关联路由
 * 比如：字典页面进入字典详情页面的路由不会在页面创建，就通过这个来关联
 * 目前关联的路由和key所代表的路由处于同一级
 */
export const relationRoutes: {
    [key: string]: RouteRecordRaw[]
} = {
    "system/Dict": [
        {
            path: "dict-data/:identifier",
            name: "DictData",
            component: () => import("@/views/system/DictData.vue"),
            props(route) {
                return {
                    ...route.params,
                    ...route.query
                }
            },
            meta: {
                title: "字典数据",
                icon: "Finished",
            }
        }
    ]
}